# WS client example

import asyncio
import websockets
import time

DEVICE_ID = "8"




async def query():
    
    async with websockets.connect('ws://localhost:8080/websocket/'+DEVICE_ID) as websocket:
        while True:
            # await websocket.send(number)
            greeting = await websocket.recv()
            print(f"< {greeting}")


def main():
    try:
        while True:
            asyncio.get_event_loop().run_until_complete(query())
            time.sleep(5)

    except OSError:
        print("connect err..")
        

if __name__ == "__main__":
    main()

